// $Id: user_channels.js 188 2008-09-15 17:00:26Z hugo.wetterberg $
Drupal.user_channels = {
  'subscriptions': function(type,forced) {
    var subs = [];
    
    var type_filter = function(raw_subs) {
      var sub_length = raw_subs.length;
      for(var k in raw_subs) {
        if (raw_subs[k][2] == type || type & raw_subs[k][2]) {
          subs[k] = raw_subs[k];
        }
      }
    };
    
    if (!forced) {
      type_filter(Drupal.settings.user_channels.subscriptions);
    }
    else {
      type_filter(Drupal.settings.user_channels.forced_subscriptions);
    }
    
    return subs;
  }
};